package com.yanq.liancar.adapter;

import android.support.annotation.Nullable;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yanq.liancar.R;
import com.yanq.liancar.bean.FindBean;
import com.yanq.liancar.util.LogUtils;

import java.util.List;

/**
 * Created by wyq on 2018/5/25.
 */

public class FindAdapter extends BaseQuickAdapter<FindBean.DataBean, BaseViewHolder> {


    public FindAdapter(int layoutResId, @Nullable List<FindBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, FindBean.DataBean item) {
        LogUtils.d("getNewslikesnum()===",item.getNewslikesnum() + "");
        helper.setText(R.id.news_title, item.getNewsname())
                .setText(R.id.news_content, item.getNewscontent())
                .setText(R.id.dianzan, item.getNewslikesnum() + "")
                .setText(R.id.pinglun, item.getNewscommentnum() + "")
                .setText(R.id.shoucang, item.getNewsattentionnum() + "")
                .addOnClickListener(R.id.dianzan)
                .addOnClickListener(R.id.pinglun)
                .addOnClickListener(R.id.shoucang);

        Glide.with(mContext).load(item.getNewsimage()).into((ImageView) helper.getView(R.id.news_img1));

//        TextView tv_shoucang=helper.getView(R.id.shoucang);
//        if ()
    }
}
